package org.vaadin.nf4v.core.navigation.event;

/**
 * Represents current navigation request state.
 * When request reaches some state, framework fires event (to notify listeners about state activation)
 * Global state listeners may be registered using NavigationManager.
 * Local state listeners may be registered through Navigator object of current window.
 */
public enum NavigationState {
    /**
     * Navigation to different context received.
     * This event not necessary leads to CONTEXT_ACTIVATED event (only if target context is not created yet,
     * or new tab navigation requested)
     * // todo currently contexts support is limited: it is impossible to navigate to already opened tab from other tab
     */
    CONTEXT_NAVIGATION,
    /**
     * Casted when new context is activated.
     * It means when application window instantiated.
     * After that event framework can continue cross context navigation or initiate home page navigation.
     * New context creation may be initiated by cross context navigation and direct context url typing in
     * browser address bar.
     */
    CONTEXT_ACTIVATED,
    /**
     * Navigation to new page received.
     * Navigation target recognized, parameters correctly parsed.
     * Note: not called on page reload or parameters change (see PAGE_PARAMETERS_CHANGE)
     */
    PAGE_NAVIGATION,
    /**
     * Current page reload received.
     * Navigation target recognized, parameters correctly parsed.
     * Usually it's page parameter change request
     *
     * Note: not called on new page navigation (see PAGE_NAVIGATION)
     */
    PAGE_PARAMETERS_CHANGE,
    /**
     * Page instantiated.
     * Note: it's the last stage when request may be interrupted (cancelled)
     */
    PAGE_INSTANTIATED,
    /**
     * Called before page change.
     * It is not possible to cancel request on this state
     */
    BEFORE_NAVIGATION,
    /**
     * Called after page change.
     * It is not possible to cancel request on this state
     */
    AFTER_NAVIGATION
}
